#ifndef YEPXML_HIERARCHICALWRITTER_HPP
#define YEPXML_HIERARCHICALWRITTER_HPP

#include "writter.hpp"
#include "lineseparatedwritter.hpp"

namespace yxml
{
    /**
     * @brief An old version of Hierarchical Use HierarchicalWritter instead.
     *  @deprecated
     **/
    class HierarchicalWritterDeprecated: public Writter
    {
    public:
        /// Constructor
        HierarchicalWritterDeprecated(ostream &out);
        /// write on document
        void write(Document &document);
    private:
        void writeNode(Node &node);
        int _level;
    };

    /**
     * @brief Writes the document in a hierarchy
     **/
    class HierarchicalWritter: public LineSeparatedWritter
    {
    public:
        /**
         * @brief Constructor
         * @param out The output stream to write.
         **/
        HierarchicalWritter(ostream &out);

        /**
         * @brief Returns the identationIncrement
         **/
        int identationIncrement( void ) const
        {
            return _identationIncrement;
        }

        /**
         * @brief Changes the identationIncrement]
         **/
        void identationIncrement( int value )
        {
            _identationIncrement = value;
        }
    protected:
        inline string getIdentation()
        {
            return string(_identationLevel, ' ');
        }

    private:
        void writeNode(Node &node);
        void writeSubNodes(Node &node);
        void writeComment(Node &node);
        string fixText(string s);

        int _identationLevel;
        int _identationIncrement;
    };
}

#endif // YEPXML_HIERARCHICALWRITTER_HPP
